package com.nnfe.fyd.feature.inquiryPrice;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.nnfe.fyd.R;
import com.nnfe.fyd.base.MyBaseAdapter;
import com.nnfe.fyd.bean.inquiry.RegionName;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * ----------------------------------
 * Created by xyd on 2017/3/21.
 * <p/>
 * 描  述：
 * <p/>
 * 修订历史:
 * ----------------------------------
 */

public class SelectComuunityAdapter extends MyBaseAdapter {

    private Context mContext;

    public SelectComuunityAdapter(Context mContext) {
        super(mContext);
        this.mContext = mContext;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder viewHolder = null;
        if (convertView == null) {

            convertView = View.inflate(mContext, R.layout.layout_item_region, null);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        final RegionName itemBean = (RegionName) getItem(position);

        viewHolder.regionName.setText(itemBean.residentialareaName + "(" + itemBean.address + ")");
        return convertView;
    }

    class ViewHolder {
        @Bind(R.id.item_region)
        TextView regionName;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
